﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Ue.Extensions;

namespace Ue.Eagle.ContentManagement.MetaData.Models
{
    public class ContentTypeDefinition
    {
        public ContentTypeDefinition(string name, string displayName)
            : this(name, displayName, Enumerable.Empty<ContentTypePartDefinition>(), new SettingsDictionary()) { }

        public ContentTypeDefinition(
            string name, 
            string displayName, 
            IEnumerable<ContentTypePartDefinition> parts, 
            SettingsDictionary settings)
        {
            Name = name;
            DisplayName = displayName;
            Parts = parts.ToReadOnlyCollection();
            Settings = settings;
        }

       
        [StringLength(128)]
        public string Name { get; private set; }

        [Required, StringLength(1024)]
        public string DisplayName { get; private set; }

        public IEnumerable<ContentTypePartDefinition> Parts { get; private set; }

        public SettingsDictionary Settings { get; private set; }
    }
}
